aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/[username]/address/+page.server.js
blob: d173594a9be83304ff319eaaa14a6082e0dd858f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
import { auth, get, post } from "$lib/utils";
import { redirect } from "@sveltejs/kit";

export async function load({ cookies, params, parent }) {
  let user = (await parent()).subject;
  let rates = await get("/rates");
  let invoice = { type: "bitcoin" };
  let { id } = await post(`/invoice`, { invoice, user }, auth(cookies));
  redirect(307, `/${user.username}/invoice/${id}`);
}